package com.kelaite.procurement.entity;

// Generated 2016-3-6 15:13:23 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

/**
 * TSalesOrder generated by hbm2java
 */
@Entity(name = "t_sales_order")
public class TSalesOrder extends TBaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Long id;

	@ManyToOne(cascade = CascadeType.REFRESH, optional = false)
	@JoinColumn(name = "company_id")
	private TCompany tCompany;// companyType是supplier

	@ManyToOne(cascade = CascadeType.REFRESH, optional = false)
	@JoinColumn(name = "vendor_id")
	private TVendor tVendor;

	@Column(name = "sales_order_no", nullable = false, length = 30)
	private String salesOrderNo;

	@Column(name = "sales_order_desc", length = 200)
	private String salesOrderDesc;

	@Column(name = "start_time")
	private Date startTime;

	@Column(name = "expired_time")
	private Date expiredTime;

	// optional=true因为在甲方创建合同的时候，也会初始化t_salse_order表，此时甲方操作人员并不知道乙方负责该合同的人是谁，该信息由乙方人员自行完善
	@ManyToOne(cascade = CascadeType.REFRESH, optional = true)
	@JoinColumn(name = "user_id")
	private TUser tUser;

	@Column(name = "currency")
	private short currency;

	@Column(name = "price", nullable = false)
	private Float price; // 订单总额

	@Column(name = "order_status")
	private Short orderStatus; // 0:created, 1:executing, 2:closed, 3:deleted.

	@Column(name = "deliver_address", length = 300)
	private String deliverAddress;

	@Column(name = "purchase_order_no")
	private String purchaseOrderNo; // 甲方的采购订单号

	@Column(name = "evaluation_desc_1")
	private String evaluationDesc1;

	@Column(name = "evaluation_score_1")
	private Double evaluationScore1;

	@Column(name = "evaluation_desc_2")
	private String evaluationDesc2;

	@Column(name = "evaluation_score_2")
	private Double evaluationScore2;

	@Column(name = "evaluation_desc_3")
	private String evaluationDesc3;

	@Column(name = "evaluation_score_3")
	private Double evaluationScore3;

	@Column(name = "evaluation_desc_4")
	private String evaluationDesc4;

	@Column(name = "evaluation_score_4")
	private Double evaluationScore4;

	@Column(name = "evaluation_desc_5")
	private String evaluationDesc5;

	@Column(name = "evaluation_score_5")
	private Double evaluationScore5;

	@Column(name = "evaluation_total_desc")
	private String evaluationTotalDesc;

	@Column(name = "evaluation_total_score")
	private Double evaluationTotalScore;

	@Column(name = "evaluated_by", length = 30)
	private String evaluatedBy;

	@Column(name = "evaluation_time")
	private Date evaluationTime;

	@Column(name = "gmt_create_time")
	private Date gmtCreateTime;

	@Column(name = "gmt_update_time")
	private Date gmtUpdateTime;

	@Column(name = "created_by", length = 30)
	private String createdBy;

	@Column(name = "updated_by", length = 30)
	private String updatedBy;

	@Column(name = "is_delete")
	private boolean isDelete;

	@OneToMany(mappedBy = "tSalesOrder", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@OrderBy(value = "id ASC")
	private Set<TSalesOrderItems> tSalesOrderItems = new HashSet<TSalesOrderItems>();

	@OneToMany(mappedBy = "tSalesOrder", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@OrderBy(value = "id ASC")
	private Set<TSalesOrderExecution> tSalesOrderExecutions = new HashSet<TSalesOrderExecution>();

	@OneToMany(mappedBy = "tSalesOrder", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@OrderBy(value = "id ASC")
	private Set<TSalesOrderPayment> tSalesOrderPayment = new HashSet<TSalesOrderPayment>();

	public TSalesOrder() {

	}

	public Long getId() {

		return id;
	}

	public void setId(Long id) {

		this.id = id;
	}

	public TCompany gettCompany() {

		return tCompany;
	}

	public void settCompany(TCompany tCompany) {

		this.tCompany = tCompany;
	}

	public TVendor gettVendor() {

		return tVendor;
	}

	public void settVendor(TVendor tVendor) {

		this.tVendor = tVendor;
	}

	public String getSalesOrderNo() {

		return salesOrderNo;
	}

	public void setSalesOrderNo(String salesOrderNo) {

		this.salesOrderNo = salesOrderNo;
	}

	public String getSalesOrderDesc() {

		return salesOrderDesc;
	}

	public void setSalesOrderDesc(String salesOrderDesc) {

		this.salesOrderDesc = salesOrderDesc;
	}

	public Date getStartTime() {

		return startTime;
	}

	public void setStartTime(Date startTime) {

		this.startTime = startTime;
	}

	public Date getExpiredTime() {

		return expiredTime;
	}

	public void setExpiredTime(Date expiredTime) {

		this.expiredTime = expiredTime;
	}

	public TUser gettUser() {

		return tUser;
	}

	public void settUser(TUser tUser) {

		this.tUser = tUser;
	}

	public short getCurrency() {

		return currency;
	}

	public void setCurrency(short currency) {

		this.currency = currency;
	}

	public Float getPrice() {

		return price;
	}

	public void setPrice(Float price) {

		this.price = price;
	}

	public Short getOrderStatus() {

		return orderStatus;
	}

	public void setOrderStatus(Short orderStatus) {

		this.orderStatus = orderStatus;
	}

	public String getDeliverAddress() {

		return deliverAddress;
	}

	public void setDeliverAddress(String deliverAddress) {

		this.deliverAddress = deliverAddress;
	}

	public String getPurchaseOrderNo() {

		return purchaseOrderNo;
	}

	public void setPurchaseOrderNo(String purchaseOrderNo) {

		this.purchaseOrderNo = purchaseOrderNo;
	}

	public String getEvaluationDesc1() {

		return evaluationDesc1;
	}

	public void setEvaluationDesc1(String evaluationDesc1) {

		this.evaluationDesc1 = evaluationDesc1;
	}

	public Double getEvaluationScore1() {

		return evaluationScore1;
	}

	public void setEvaluationScore1(Double evaluationScore1) {

		this.evaluationScore1 = evaluationScore1;
	}

	public String getEvaluationDesc2() {

		return evaluationDesc2;
	}

	public void setEvaluationDesc2(String evaluationDesc2) {

		this.evaluationDesc2 = evaluationDesc2;
	}

	public Double getEvaluationScore2() {

		return evaluationScore2;
	}

	public void setEvaluationScore2(Double evaluationScore2) {

		this.evaluationScore2 = evaluationScore2;
	}

	public String getEvaluationDesc3() {

		return evaluationDesc3;
	}

	public void setEvaluationDesc3(String evaluationDesc3) {

		this.evaluationDesc3 = evaluationDesc3;
	}

	public Double getEvaluationScore3() {

		return evaluationScore3;
	}

	public void setEvaluationScore3(Double evaluationScore3) {

		this.evaluationScore3 = evaluationScore3;
	}

	public String getEvaluationDesc4() {

		return evaluationDesc4;
	}

	public void setEvaluationDesc4(String evaluationDesc4) {

		this.evaluationDesc4 = evaluationDesc4;
	}

	public Double getEvaluationScore4() {

		return evaluationScore4;
	}

	public void setEvaluationScore4(Double evaluationScore4) {

		this.evaluationScore4 = evaluationScore4;
	}

	public String getEvaluationDesc5() {

		return evaluationDesc5;
	}

	public void setEvaluationDesc5(String evaluationDesc5) {

		this.evaluationDesc5 = evaluationDesc5;
	}

	public Double getEvaluationScore5() {

		return evaluationScore5;
	}

	public void setEvaluationScore5(Double evaluationScore5) {

		this.evaluationScore5 = evaluationScore5;
	}

	public String getEvaluationTotalDesc() {

		return evaluationTotalDesc;
	}

	public void setEvaluationTotalDesc(String evaluationTotalDesc) {

		this.evaluationTotalDesc = evaluationTotalDesc;
	}

	public Double getEvaluationTotalScore() {

		return evaluationTotalScore;
	}

	public void setEvaluationTotalScore(Double evaluationTotalScore) {

		this.evaluationTotalScore = evaluationTotalScore;
	}

	public String getEvaluatedBy() {

		return evaluatedBy;
	}

	public void setEvaluatedBy(String evaluatedBy) {

		this.evaluatedBy = evaluatedBy;
	}

	public Date getEvaluationTime() {

		return evaluationTime;
	}

	public void setEvaluationTime(Date evaluationTime) {

		this.evaluationTime = evaluationTime;
	}

	public Date getGmtCreateTime() {

		return gmtCreateTime;
	}

	public void setGmtCreateTime(Date gmtCreateTime) {

		this.gmtCreateTime = gmtCreateTime;
	}

	public Date getGmtUpdateTime() {

		return gmtUpdateTime;
	}

	public void setGmtUpdateTime(Date gmtUpdateTime) {

		this.gmtUpdateTime = gmtUpdateTime;
	}

	public String getCreatedBy() {

		return createdBy;
	}

	public void setCreatedBy(String createdBy) {

		this.createdBy = createdBy;
	}

	public String getUpdatedBy() {

		return updatedBy;
	}

	public void setUpdatedBy(String updatedBy) {

		this.updatedBy = updatedBy;
	}

	public boolean isDelete() {

		return isDelete;
	}

	public void setDelete(boolean isDelete) {

		this.isDelete = isDelete;
	}

	public Set<TSalesOrderItems> gettSalesOrderItems() {

		return tSalesOrderItems;
	}

	public void settSalesOrderItems(Set<TSalesOrderItems> tSalesOrderItems) {

		this.tSalesOrderItems = tSalesOrderItems;
	}

	public Set<TSalesOrderExecution> gettSalesOrderExecutions() {

		return tSalesOrderExecutions;
	}

	public void settSalesOrderExecutions(
			Set<TSalesOrderExecution> tSalesOrderExecutions) {

		this.tSalesOrderExecutions = tSalesOrderExecutions;
	}

	public Set<TSalesOrderPayment> gettSalesOrderPayment() {

		return tSalesOrderPayment;
	}

	public void settSalesOrderPayment(Set<TSalesOrderPayment> tSalesOrderPayment) {

		this.tSalesOrderPayment = tSalesOrderPayment;
	}

}
